package com.kayoxu.ble_printer.utils

import cn.shomes.smart_lock_flutter.utils.ble.FlutterData
import com.kayoxu.ble_printer.BlePrinterPlugin


class EventType {
    companion object {
        val BLE_FOUND: Int = 1
        val BLE_CONNECTED: Int = 2
        val BLE_CONNECTE_FAILED: Int = 3
        val BLE_DISCONNECTED: Int = 4
        val BLE_CONNECTE_NODEVICE: Int = 5
        val BLE_ENABLE: Int = 8
        val BLE_DISABLE: Int = 9
    }
}

class FlutterDataUtils {

    companion object {

        fun <T> sendEvent(type: Int, data: T?, ret: Int = 1) {
            val retData = FlutterData.RetData<T>()
            retData.ret = ret
            retData.type = type
            retData.data = data
            val d = GsonUtils.beanToJson(retData)
            BlePrinterPlugin.sendEvent(d)
        }
    }


}